package com.lannuokeji.biz.ac.controller;


import java.util.List;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.lannuokeji.base.AController;
import com.lannuokeji.base.facade.PageRequest;
import com.lannuokeji.biz.ac.entity.UserRole;
import com.lannuokeji.biz.ac.service.UserRoleService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * <p>
 * 用户业务分类 前端控制器
 * </p>
 *
 * @author lannuoTeck
 * @since 2018-03-17
 */
@Api("用户组")
@RestController
@RequestMapping("/ac/userRole")
public class UserRoleController extends AController {

	@Resource
	UserRoleService userRoleService;
	
	@ApiOperation(value = "查询列表")
	@GetMapping()
	public Object getList() {
		List<UserRole> l = userRoleService.selectList(new EntityWrapper<>());
		return setSuccessContent(l);
	}
	
	@ApiOperation(value = "查询列表")
	@GetMapping("/page")
	public Object getList(PageRequest pageRequest, UserRole entity) {
		Page page = new Page(pageRequest.getCurrent(), pageRequest.getSize());
		EntityWrapper<UserRole> entityWrapper = new EntityWrapper<>();
		entityWrapper.eq("status", 1);
		page = userRoleService.selectPage(page, entityWrapper);
		return setSuccessContent(page);
	}
}

